/*package com.paradox.aggregation.consumer.sentinel;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.BlockExceptionHandler;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.alibaba.csp.sentinel.slots.block.authority.AuthorityException;
import com.alibaba.csp.sentinel.slots.block.degrade.DegradeException;
import com.alibaba.csp.sentinel.slots.block.flow.FlowException;
import com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowException;
import com.alibaba.csp.sentinel.slots.system.SystemBlockException;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;*/

/*@Component
public class CustomBlockExceptionHandler implements BlockExceptionHandler {
    @Override
    public void handle(HttpServletRequest request, HttpServletResponse response, BlockException e) throws Exception {
        String res="";
        if (e instanceof FlowException) {
            res="接口限流了";

        } else if (e instanceof DegradeException) {
            res="服务降级了";

        } else if (e instanceof ParamFlowException) {
            res="热点参数限流了";

        } else if (e instanceof SystemBlockException) {
            res="触发系统保护规则了";

        } else if (e instanceof AuthorityException) {
            res="授权规则不通过";
        }
        response.setCharacterEncoding("utf-8");
        response.setContentType(MediaType.TEXT_PLAIN_VALUE);
        response.getWriter().write(res);
    }
}*/
